﻿using System;
using System.Windows.Forms;
using System.Threading;

namespace TFSRequestManager
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            bool mutexAcquired = false;

            using (Mutex mutex = new Mutex(true, "TFSRequestManagerMutex", out mutexAcquired))
            {
                if (mutexAcquired)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new MainForm());

                    mutex.ReleaseMutex();
                }
                else
                {
                    // Another instance already exits. Bail out without doing anything.
                }
            }
        }
    }
}
